﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;

namespace LightSwitchApplication
{
    public partial class ContactDetail
    {
        partial void Contact_Loaded(bool succeeded)
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Contact);
        }

        partial void Contact_Changed()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Contact);
        }

        partial void ContactDetail_Saved()
        {
            // Write your code here.
            this.SetDisplayNameFromEntity(this.Contact);
        }

        partial void ContactAddressesAddAndEditNew_CanExecute(ref bool result)
        {
            // Write your code here.

        }

        partial void ContactAddressesAddAndEditNew_Execute()
        {
            this.Application.ShowCreateNewAddress(0, 0, this.Contact.Id, 0);
        }

        partial void ContactAddressesEditSelected_CanExecute(ref bool result)
        {
            // Write your code here.

        }

        partial void ContactAddressesEditSelected_Execute()
        {
            if (this.ContactAddresses.SelectedItem != null)
                this.Application.ShowAddressDetail(this.ContactAddresses.SelectedItem.Id);
        }

        partial void ContactDetail_Activated()
        {
            this.DisplayName = this.Contact.Id.ToString() + " (Контакт)";
        }

        partial void ShowAuditHistory_Execute()
        {
            this.Application.ShowAuditLogHistory("Контакт", this.Contact.Id);
        }
    }
}